<?php
class admin_categoryController extends adminController{

    //首页
    public function index() {
        //获取专题分类列表
        $this->list=model('special_category')->special_list();
        $this->show();  
    }

    //添加
    public function add() {
        $this->action_name='添加';
        $this->action='add';
        $this->class_list=model('special_category')->special_list();
        $this->tpl_list=api('admin','tpl_list');
        $this->show('admin_category/info'); 
    }

    public function add_save() {
        //录入模型处理
        model('special_category')->add($_POST);
        $this->msg('专题分类添加成功！',1);
    }

    //修改
    public function edit() {
        $cid=$_GET['cid'];
        $this->alert_str($cid,'int');
        $this->info=model('special_category')->info($cid);
        $this->class_list=model('special_category')->special_list();
        $this->tpl_list=api('admin','tpl_list');
        $this->action_name='编辑';
        $this->action='edit';
        $this->show('admin_category/info'); 
    }

    public function edit_save() {
        $cid=$_POST['cid'];
        $this->alert_str($cid,'int',true);
        //录入模型处理
        model('special_category')->edit($_POST);
        $this->msg('专题分类修改成功! ',1);
    }

    //删除
    public function del() {
        $cid=intval($_POST['cid']);
        $this->alert_str($cid,'int',true); 
        //录入模型处理
        model('special_category')->del($cid);
        $this->msg('专题分类删除成功！',1);
    }


}